<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script>
	var submitForm = ''
	$(window).ready(initValidate);
	function initValidate(){
		  submitForm = $('#submitForm')[0];
		  submitForm.validators = new Array();
		  var inputEl = $.find('input[name=user.userName]')[0];
		  submitForm.validators.push(new AccountValidator(inputEl, "<s:url action='user!ajaxAccountValidate' namespace='/user' />?user.id="+'${user.id}', "用户名已存在",$('#errorInfo')[0],true));
		  submitForm.validators.push(new NullValidator(inputEl, "用户名不能为空",$('#errorInfo')[0],true));
		  inputEl = $.find('input[name=user.email]')[0];
		  submitForm.validators.push(new AccountValidator(inputEl, "<s:url action='user!ajaxAccountValidate' namespace='/user' />?user.id="+'${user.id}', "电子邮箱已存在",$('#errorInfo')[0],true));
		  submitForm.validators.push(new NullValidator(inputEl, "电子邮箱不能为空",$('#errorInfo')[0],true));
		  inputEl = $.find('input[name=user.password]')[0];
		  submitForm.validators.push(new PasswordLengthValidator(inputEl, 6, "密码不能少于6位", $('#errorInfo')[0], true));
		  submitForm.validators.push(new NullValidator(inputEl, "密码不能为空",$('#errorInfo')[0],true));
		  inputEl = $.find('input[name=user.repassword]')[0];
		  //submitForm.validators.push(new NullValidator(inputEl, "确认密码不能为空",$('#errorInfo')[0],true));
		  submitForm.validators.push(new PasswordConsistValidator(inputEl, $.find('input[name=user.password]')[0], "两次密码不一致", $('#errorInfo')[0], true));
		  inputEl = $.find('input[name=user.fax]')[0];
		  submitForm.validators.push(new PhoneNumberFaxValidator(inputEl, $.find('input[name=user.mobile]')[0], "手机号码或传真号至少有一个", $('#errorInfo')[0], true));
          
		  
	}
	function doValidate(event){
		formSubmitRequest(event,submitForm);
	}
</script>